<template>
    <div class="aside-div"  v-if="topicShow">
        <el-card class="box-card">
            <avue-data-icons :option="topicOption"></avue-data-icons>
        </el-card>
    </div>
</template>

<script>
    import {
        isNull
    } from '../util/util'
    export default{
        data() {
            return {
                topicShow: false,
                topicOption: {
                    span:8,
                    data: []
                },
            }
        },
        created() {
            this.getWebTopics()
        },
        methods: {
            getWebTopics() {
                const _this = this
                const params = {}
                _this.axios.post(_this.$API.ZHIHUAPI.getWebTopics, _this.qs.stringify(params)).then((res) => {
                    res = res.data
                    // console.log(res)
                    if (res.code === 10000) {
                        if (res.hasOwnProperty('data') && Object.keys(res.data).length > 0) {
                            _this.topicOption.data = res.data
                            _this.topicShow = true
                        } else {
                            _this.topicOption.data = []
                            _this.topicShow = false
                        }
                    } else {
                        _this.topicOption.data = []
                        _this.topicShow = false
                    }
                }).catch(() => {
                    _this.topicOption.data = []
                    _this.topicShow = false
                })
            },
        }
    }
</script>

<style>
</style>
